import EnumChartsRoutes from '@/pages/dv/charts';

/**
 * 图表组件操作行为
 */
export const EnumChartActions = {
  backout: {
    category: 'backout',
    label: '撤销',
    icon: 'icon-backout',
    disabled: true,
    onClick: 'handleBackout'
  },
  rewrite: {
    category: 'rewrite',
    label: '重做',
    icon: 'icon-rewrite',
    disabled: false,
    onClick: 'handleRewrite'
  },
  copy: {
    category: 'copy',
    label: '复制图表',
    icon: 'icon-copy',
    disabled: false,
    onClick: 'handleCopy'
  },
}

export interface IChartCategory {
  category: string,
  label: string,
  icon: string,
  store?: {
    [key: string]: IChartLegend
  } | DV.IChartRoute[]
}

export interface IChartLegend {
  title?: string;
  showTitle?: boolean;
  data?: DV.IChartRoute[]
}
export type IHeaderChartsToolbar = IChartCategory[]

/**
 * 图表组件库
 */
export const EnumChartsToolbar: IHeaderChartsToolbar = [
  {
    category: 'aiChart',
    label: '智能图表',
    icon: 'icon-ai',
  },
  {
    category: 'charts',
    label: '图表',
    icon: 'icon-chart',
    store: {
      line:{
        title: '折线图',
        showTitle: true,
        data: [
          EnumChartsRoutes.echarts_line,
        ]
      },
      bar:{
        title: '柱状图',
        showTitle: true,
        data: [
          EnumChartsRoutes.echarts_line,
        ]
      },
      pie:{
        title: '饼图',
        showTitle: true,
        data: [
          EnumChartsRoutes.echarts_init,
        ]
      },
      init:{
        title: 'Echarts模板',
        showTitle: true,
        data: [
          EnumChartsRoutes.echarts_init,
        ]
      }
    }
  },
  {
    category: 'advanceCharts',
    label: '高级图表',
    icon: 'icon-advanceChart',
  },
  {
    category: 'table',
    label: '表格',
    icon: 'icon-table',
  },
  {
    category: 'indexNumber',
    label: '指标',
    icon: 'icon-indexNumber',
  },
  {
    category: 'map',
    label: '地图',
    icon: 'icon-map',
  },
   {
    category: 'textBox',
    label: '文字',
    icon: 'icon-textBox',
    store: [
      EnumChartsRoutes.html_text,
      EnumChartsRoutes.html_link,
    ]
  },
  {
    category: 'mediaBox',
    label: '媒体',
    icon: 'icon-media',
    store: [
      EnumChartsRoutes.html_iframe
    ]
  },
]

/**
 * 辅助功能
 */
export const EnumHelper = {
  helpWord: {
    category: 'helpWord',
    label: '帮助文档',
    icon: 'icon-helper',
  },
  consult: {
    category: 'consult',
    label: '咨询反馈',
    icon: 'icon-zixun',
  },
}

/**
 * 大屏操作行为
 */
export const EnumDvActions = {
  saveAndPreview: {
    category: 'saveAndPreview',
    label: '保存并预览',
    icon: 'icon-savePreview',
    onClick: 'onSaveAndPreview'
  },
  save: {
    category: 'save',
    label: '保存',
    icon: 'icon-save',
    onClick: 'onSave'
  },
  cancel: {
    category: 'cancel',
    label: '退出',
    icon: 'icon_cancel',
    onClick: 'onCancel',
  },
}
